// Johnathon Trumble
// Module 1
// September 9, 2008
// Revision 1.0

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

void help(char func[]);

int main(){
char arg1[10]="version";

help(arg1);

system("pause");

return 0;
}  //end main

// Begin help module.  Ignore main function, as the command line
// interface should call the function and pass arguments.

void help(char func[]){
FILE *file;
char s[80], t[80];

char fn[20]="HELP\\";

printf("Entering help...\n \n");

if(func == NULL){
   file=fopen("HELP\\COMMAND.TXT","r");
   if(file==NULL){
      printf("Cannot open command list.  Sorry :( \n \n");

   }
   else{
      while(fgets(s, 80, file)){
      fputs(s, stdout);
      }
      printf("\n \n");
   }
}
else{
   strcat(fn,func);
   strcat(fn,".HLP");

   file=fopen(fn,"r");
   if(file==NULL){
       printf("Cannot open specified function definition.  Sorry :( \n \n");

   }
   else{
      while(fgets(s, 80, file)){
      fputs(s, stdout);
      }
      printf("\n");
      printf("\n");
   }
}

} //end help
